package com.learn.ioc.component;

import com.learn.ioc.api.Happy;

public class HappyComponent implements Happy {

    private String happyNameFiled;
    private HappyMachine happyMachine;

    public HappyMachine getHappyMachine() {
        return happyMachine;
    }

    public void setHappyMachine(HappyMachine happyMachine) {
        this.happyMachine = happyMachine;
    }


    public void init() {
        System.out.println("happyComponent init 调用");
    }
    public void destroy() {
        System.out.println("happyComponent destroy 调用");
    }

    public HappyComponent() {
        System.out.println("happyComponent 构造器 调用");
    }

    public HappyComponent(String happyName) {
        this.happyNameFiled = happyName;
    }


    public String getHappyName() {
        return happyNameFiled;
    }

    public void setHappyName(String happyName) {
        System.out.println("happyComponent set 方法调用");
        this.happyNameFiled = happyName;
    }

    public void doWork(){
        System.out.println("I am working");
    }
}
